package com.jishuo.nontax.bean.vo;

import com.jishuo.base.util.StringObject;
import com.jishuo.nontax.bean.bank.IllegalactivityScaleDetail;
import com.jishuo.nontax.bean.bank.IllegalactivityScaleinfo;
import com.jishuo.nontax.bean.message.*;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;

/**
 * @auther dinggaofei
 * @Date 2023/2/3 9:15
 * @tableName t_jjpayscalebill 交罚二八分成表
 */
@Data
public class PayScaleBillVO {
    /**
     * 主键唯一标识
     */
    private Long payscalebillid;

    /**
     * 单据号码
     */
    private String billnum;

    /**
     * 单据内编码
     */
    private Integer billno;

    /**
     * 划转区划ID
     */
    private Long cantonid;

    /**
     * 划款银行账户ID
     */
    private Long bankid;

    /**
     * 划转开户行名称
     */
    private String bankname;

    /**
     * 采集地行政区划
     */
    private Long collectcantonid;

    /**
     * 采集地银行账户ID
     */
    private Long collectbankid;

    /**
     * 采集地开户行名称
     */
    private String collectbankname;

    /**
     * 分成金额
     */
    private BigDecimal funds;

    /**
     * 是否付款
     */
    private Integer isbankaffirm;

    /**
     * 银行交易流水号
     */
    private String bankaffirm;

    /**
     * 交易日期
     */
    private String paybankdt;

    /**
     * 银行网点
     */
    private String bankstation;

    /**
     * 打印时间
     */
    private String writedate;

    /**
     *
     */
    private Integer issend;

    /**
     *
     */
    private Long messageid;

    /**
     * 单据状态
     */
    private Integer billstate;

    /**
     * 发送时间
     */
    private String sendtime;

    /**
     * 银行核心交易流水号
     */
    private String hxbankaffirm;

    /**
     * 帐号
     */
    private String accountcode;
    /**
     * 帐户名称
     */
    private String accountname;
    /**
     * 区划编码
     */
    private String cantoncode;
    /**
     * 区划名称
     */
    private String cantonname;
    /**
     * 联行行号
     */
    private String banklinename;
    /**
     * 页面列表
     */

    private String payerbankid;
    private String payeraccountname;
    private String payeebankid;
    private String payerbankname;
    private String payeraccountcode;
    private String payeebankname;
    private String payeeaccountname;
    private String payeeaccountcode;

    private  String billid;

    private ArrayList<IllegalactivityScaleDetail> detail;

    public PayScaleBillVO() {
    }


    //从SetIllegalactivityScaleinfo获取数据
    public PayScaleBillVO(SetIllegalactivityScaleinfo info) {
        this.bankid = Long.parseLong(info.getBankid());
        this.billnum = info.getBillnum();
        ArrayList<SetBankIllegalactivityScaleinfoDetail> list = new ArrayList<>();
        for (SetBankIllegalactivityScaleinfoDetail detal : list
        ) {
            this.billno = Integer.parseInt(detal.getDetailno());
            this.collectcantonid = Long.parseLong(detal.getCollectcantonid());
            this.collectbankid = Long.parseLong(detal.getCollectbankid());
            this.funds = new BigDecimal(detal.getCollectfund());
        }
    }

    //返回IllegalactivityScaleinfo类
    public IllegalactivityScaleinfo getIllegalactivityScale() {
        IllegalactivityScaleinfo info = new IllegalactivityScaleinfo();
        info.setBillstate(StringObject.objectString(this.billstate));
        info.setBillnum(this.billnum);
        info.setBankid(StringObject.objectString(this.bankid));
        info.setAccountcode(this.accountcode);
        info.setAccountname(this.accountname);
        info.setBankname(this.bankname);
        ArrayList<IllegalactivityScaleDetail> list = new ArrayList<>();
        info.setDetail(list);
        return info;
    }

    //返回IllegalactivityScaleDetail类
    public IllegalactivityScaleDetail findIllScaleDetail() {
        IllegalactivityScaleDetail detail = new IllegalactivityScaleDetail();
        detail.setDetailno(StringObject.objectString(this.billno));
        detail.setCollectcantonid(StringObject.objectString(this.collectcantonid));
        detail.setCantoncode(this.cantoncode);
        detail.setCantonname(this.cantonname);
        detail.setCollectbankid(StringObject.objectString(this.collectbankid));
        detail.setAccountcode(this.accountcode);
        detail.setAccountname(this.accountname);
        detail.setBankname(this.banklinename + this.bankname);
        detail.setCollectfund(StringObject.objectString(this.funds));
        return detail;
    }

    //返回SetBankIllegalactivityScaleinfo类
    public SetBankIllegalactivityScaleinfo findIllScaleSend() {
        ArrayList<SetBankIllegalactivityScaleinfoDetail> list = new ArrayList<>();
        SetBankIllegalactivityScaleinfo info = new SetBankIllegalactivityScaleinfo();
        SetBankIllegalactivityScaleinfoDetail detail = new SetBankIllegalactivityScaleinfoDetail();
        detail.setDetailno(StringObject.objectString(this.billno));
        detail.setCollectcantonid(StringObject.objectString(this.collectcantonid));
        detail.setCollectbankid(StringObject.objectString(this.collectbankid));
        detail.setBankaffirm(this.bankaffirm);
        detail.setBankstation(this.bankstation);
        detail.setPaybankdt(this.paybankdt);
        detail.setCollectfund(StringObject.objectString(this.funds));
        info.setBankid(StringObject.objectString(this.bankid));
        list.add(detail);
        info.setDetail(list);
        return info;
    }

    public SetBankIllegalactivityScaleinfoDetail getDetails() {
        SetBankIllegalactivityScaleinfoDetail bean = new SetBankIllegalactivityScaleinfoDetail();
        bean.setDetailno(StringObject.objectString(this.billno));
        bean.setCollectcantonid(StringObject.objectString(this.collectcantonid));
        bean.setCollectbankid(StringObject.objectString(this.collectbankid));
        bean.setCollectfund(StringObject.objectString(this.funds));
        bean.setBankaffirm(this.bankaffirm);
        bean.setPaybankdt(this.paybankdt);
        bean.setBankstation(this.bankstation);
        return bean;
    }

    public SetBankIllegalactivityScaleinfo getSetBankIllegalactivityScaleinfo() {
        SetBankIllegalactivityScaleinfo info = new SetBankIllegalactivityScaleinfo();
        info.setBankid(StringObject.objectString(this.bankid));
        info.setBillnum(this.billnum);
        ArrayList<SetBankIllegalactivityScaleinfoDetail> detail = new ArrayList<SetBankIllegalactivityScaleinfoDetail>();
        SetBankIllegalactivityScaleinfoDetail div = new SetBankIllegalactivityScaleinfoDetail();
        div.setDetailno(StringObject.objectString(this.billno));
        div.setCollectcantonid(StringObject.objectString(collectcantonid));
        div.setCollectbankid(StringObject.objectString(collectbankid));
        div.setCollectfund(StringObject.objectString(this.funds));
        div.setBankaffirm(bankaffirm);
        div.setPaybankdt(paybankdt);
        div.setBankstation(bankstation);

        detail.add(div);
        info.setDetail(detail);
        return info;
    }

    public SetBankIllegalactivityScaleinfoBackOut getSetBankIllegalactivityScaleinfoBackOut() {
        SetBankIllegalactivityScaleinfoBackOut div = new SetBankIllegalactivityScaleinfoBackOut();
        div.setBillnum(billnum);
        div.setBankid(StringObject.objectString(bankid));
        div.setDetailno(StringObject.objectString(this.billno));
        div.setCollectcantonid(StringObject.objectString(collectcantonid));
        div.setCollectbankid(StringObject.objectString(collectbankid));
        div.setCollectfund(StringObject.objectString(this.funds));
        div.setBankaffirm(bankaffirm);
        div.setPaybankdt(paybankdt);
        div.setBankstation(bankstation);
       return  div;
    }
}
